package org.example.file;

import java.io.File;
import java.io.IOException;
import java.nio.file.*;

public class FileRenameExample {
    public static final String FILE_PATH = "C:\\Users\\JohnConnor\\Documents\\Downloads\\catalina.out";
    public static final String TAR_FILE_PATH = "C:\\Users\\JohnConnor\\Documents\\Downloads\\newfolder\\catalina1.out";
    public static void main(String[] args) throws IOException {
        /*Files.move(Paths.get(FILE_PATH),Paths.get(TAR_FILE_PATH));*/
        /*Files.move(Paths.get(FILE_PATH),Paths.get(TAR_FILE_PATH).resolveSibling("catalina1.out"), StandardCopyOption.REPLACE_EXISTING);*/
        Files.createDirectories(Paths.get(TAR_FILE_PATH).getParent());
        /*Files.move(Paths.get(FILE_PATH),Paths.get(TAR_FILE_PATH));*/
        File file = new File(FILE_PATH);
        file.renameTo(new File(TAR_FILE_PATH));

    }
}
